package ru.silviasaint.fridge.client.widgets.ingredient;

import ru.silviasaint.fridge.shared.bean.ProductSkinny;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.HorizontalSplitPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;

public class IngredientWidget extends Composite implements HasValue<ProductSkinny>{

	private static IngredientWidgetUiBinder uiBinder = GWT
			.create(IngredientWidgetUiBinder.class);

	interface IngredientWidgetUiBinder extends
			UiBinder<Widget, IngredientWidget> {
	}
	private ProductSkinny value;
	@UiField(provided=true)
	Image image;
	public IngredientWidget(ProductSkinny product) {
		setValue(product);
		image.setUrl("product/" + product.getValue());

		initWidget(uiBinder.createAndBindUi(this));

	}

	@Override
	public HandlerRegistration addValueChangeHandler(
			ValueChangeHandler<ProductSkinny> paramValueChangeHandler) {

		return null;
	}

	@Override
	public ProductSkinny getValue() {
		return value;
	}

	@Override
	public void setValue(ProductSkinny value) {
		this.value = value;
	}

	@Override
	public void setValue(ProductSkinny value, boolean paramBoolean) {
		this.value = value;
	}

}
